- 
                Notifications
    
You must be signed in to change notification settings  - Fork 3
 
Code revision #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Added tests Reformulated functions, and added lighter ones for real numbers as suggested in JuliaMath/SpecialFunctions.jl#407
          
 They also return  On my computer, with the changes in this PR the benchmarks are roughly twice as fast for  On masterjulia> using FresnelIntegrals, QuadGK, BenchmarkTools
julia> @btime fresnelc(1.8)
  196.234 ns (0 allocations: 0 bytes)
0.3336329272215571 + 0.0im
julia> @btime quadgk(t->cos(π*t^2/2),0,1.8)
  950.158 ns (36 allocations: 1.02 KiB)
(0.33363292722155713, 1.348964606684433e-9)This PRjulia> using FresnelIntegrals, BenchmarkTools, QuadGK
julia> @btime fresnelc(1.8)
  95.555 ns (0 allocations: 0 bytes)
0.33363292722155713
julia> @btime quadgk(t->cos(π*t^2/2),0,1.8)
  988.727 ns (40 allocations: 1.08 KiB)
(0.33363292722155713, 1.348964606684433e-9)Another improvement of this PR is that it avoids duplicate computations in  On masterjulia> @btime fresnel(1.8)
  389.158 ns (0 allocations: 0 bytes)
(0.3336329272215571 + 0.0im, 0.4509387692675832 + 0.0im)This PRjulia> @btime fresnel(1.8)
  96.117 ns (0 allocations: 0 bytes)
(0.33363292722155713, 0.4509387692675829)For completeness, here's a benchmark with complex inputs which only benefit from the improvements to  On masterjulia> @btime fresnelc($(complex(1.8)))
  196.545 ns (0 allocations: 0 bytes)
0.3336329272215571 + 0.0im
julia> @btime fresnel($(complex(1.8)))
  389.356 ns (0 allocations: 0 bytes)
(0.3336329272215571 + 0.0im, 0.4509387692675832 + 0.0im)This PRjulia> @btime fresnelc($(complex(1.8)))
  197.625 ns (0 allocations: 0 bytes)
0.33363292722155713 + 1.3877787807814457e-17im
julia> @btime fresnel($(complex(1.8)))
  198.163 ns (0 allocations: 0 bytes)
(0.33363292722155713 + 1.3877787807814457e-17im, 0.4509387692675829 + 1.3877787807814457e-17im) | 
    
| 
           Compared to the base version, this PR automatically uses the correct numerical precision for all computations because there are no  Any idea why this has not yet been merged?  | 
    
| 
           It's possible @kiranshila just forgot about it. I've been using curio-sitas's fork and it works well.  | 
    
| 
           Thanks for the ping! Not sure why, but this is the first I've seen this PR, GitHub failed to send me any notifications on any of this, wild! @curio-sitas this looks fantastic! I'll merge when I get back to my desk.  | 
    
| 
           I'll update this for all the modern julia pacakging stuff too (haven't thought about this repo since I made it for my Antennas class 4 years ago!) :)  | 
    
| 
           I'll also update the readme to include these new benchmarks  | 
    
| 
           @curio-sitas @emmt @Sagnac @devmotion Merged, updated, and pushed to the general registry as v0.2. Thanks for your work, Cheers!  | 
    
All above was suggested in JuliaMath/SpecialFunctions.jl#407
Tests are passing and the benchmark against QuadGK.jl is preserved